package com.lagou.myrpcprovider.service;

import com.lagou.myrpc.api.pojo.Order;
import com.lagou.myrpc.api.service.IOrderService;
import com.lagou.myrpcprovider.anno.RpcService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
@RpcService
public class OrderServiceImpl implements IOrderService {
    Map<String, Order> orderMap = new HashMap<>();

    @Override
    public Order getOrderById(String id) {
        if (orderMap.isEmpty()) {
            orderMap.put("1001", new Order("1001", "订单1"));
            orderMap.put("1002", new Order("1002", "订单2"));
        }

        return orderMap.get(id);
    }
}
